package com.jhs.kjs.robot.web.daum;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

import org.json.JSONException;
import org.json.JSONObject;

import com.jhs.kjs.robot.web.IConnectWeb;

public class DaumConnect implements IConnectWeb {

	public JSONObject getJsonData(String url) throws IOException, JSONException {
		if(url == null) return null;
		
		URL daumRequest = new URL(url);
		URLConnection connection = daumRequest.openConnection();
		connection.setDoOutput(true);

		/**** I'd like to get response here. ****/

		BufferedReader in = new BufferedReader(new InputStreamReader(
				connection.getInputStream()));

		return new JSONObject(in.readLine());
	}
}
